<h1><%= t(:reports) %>: <%= t(:worked_hours) %></h1>

<% if @month.blank? %>

  <form method="get">
    <p><%= label_tag t(:month) %> <%= select_tag "month", options_for_select(@months, @month) %></p>
    <p><%= submit_tag "OK" %></p>
  </form>
  <p class="back"><%= link_to t(:back), admin_reports_path %></p>

<% else %>

  <h2><%= t(:month) %>: <%= t("month_" + Date::MONTHNAMES[@month].downcase) %></h2>
  <p>
    <%= t(:month_info, :days => BranchOffice.default.business_days(@month), :holidays => BranchOffice.default.holiday_days(@month)) %>
  </p>
 </p>

  <% @users.each do |u| %>
  
  <h3><%= u.get_name %></h3>
  
  <table>
    <tr>
      <th><%= t(:date) %></th>
      <th><%= t(:status) %></th>
    </tr>
    
    <% u.punches.all(:conditions => { :created_at => @month_obj..@month_obj.end_of_month }).each do |p| %>
  
    <tr>
      <td><%= p.created_at.strftime("%d/%m/%Y %H:%M") %></td>
      <td class="<%= p.in_or_out %>"><%= p.in_or_out %></td>
    </tr>
  
    <% end %>
  </table>
  <p class="total-hours"><%= t(:worked_hours) %>: <%= u.worked_hours @month %></p>
  <p class="expected-hours"><%= t(:expected_hours) %>: <%= u.expected_hours @month %></p>
  <% end %>
  <p class="back"><%= link_to t(:back), hours_admin_reports_path %></p>

<% end %>
